# Maintainer: Frederic Wang <fred.wang@free.fr>

_realname=imagesize
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=1.0.0
pkgrel=1
pkgdesc="Getting image size from png/jpeg/jpeg2000/gif file (mingw-w64)"
url='https://github.com/shibukawa/imagesize_py'
license=('MIT')
arch=('any')
makedepends=("${MINGW_PACKAGE_PREFIX}-python2-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python3-setuptools")
#_dtoken="53/72/6c6f1e787d9cab2cc733cf042f125abec07209a58308831c9f292504e826"
source=("https://files.pythonhosted.org/packages/source/i/imagesize/${_realname}-${pkgver}.tar.gz")
sha256sums=('5b326e4678b6925158ccc66a9fa3122b6106d7c876ee32d7de6ce59385b96315')

prepare() {
  cd ${srcdir}
  cp -r ${_realname}-${pkgver} build-python2
  cp -r ${_realname}-${pkgver} build-python3
}

package_python3-imagesize() {
  depends=("${MINGW_PACKAGE_PREFIX}-python3")
  cd ${srcdir}/build-python3
  ${MINGW_PREFIX}/bin/python3 setup.py build
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}"
}

package_python2-imagesize() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2")
  cd ${srcdir}/build-python2
  ${MINGW_PREFIX}/bin/python2 setup.py build
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}"
}

package_mingw-w64-i686-python2-imagesize() {
  package_python2-imagesize
}

package_mingw-w64-i686-python3-imagesize() {
  package_python3-imagesize
}

package_mingw-w64-x86_64-python2-imagesize() {
  package_python2-imagesize
}

package_mingw-w64-x86_64-python3-imagesize() {
  package_python3-imagesize
}
